﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Text;
using System.Text.RegularExpressions;
using System.Drawing;
using System.Xml;
namespace Region.Utils
{    
    public partial class Export
    {        
        // Исходный шаблон
        byte[] m_Template = null;
        // Имя файла
        String m_OutFile = null;
        // Вставляемые значения
        Dictionary<String, Object> m_Poles = new Dictionary<String,Object>();
        // Вставляемые значения ввиде таблици
        Dictionary<String,List<Dictionary<String, Object>>> m_Tables = new Dictionary<String,List<Dictionary<String, Object>>>();
        public byte[] Template { get { return m_Template; } set { m_Template = value; } }
        public String OutFile { get { return m_OutFile; } set { m_OutFile = value; } }
        public Dictionary<String, Object> Poles { get { return m_Poles; } set { m_Poles = value; } }
        public Dictionary<String,List<Dictionary<String, Object>>> Tables { get { return m_Tables; } set { m_Tables = value; } }
        public Export() { }        
        public virtual bool Save(TaskManager.Task task = null){return false;}
        
    }    
}
/*
def WordFindReplace(Find,Fields):
    for Field in Fields:
        Value = Fields[Field]
        if Value==None: Value='';
        #print('WordFindReplace',Field,Value)
        Find.Execute(Field, False, False, False, False, False, True, wdFindContinue, False, Value, wdReplaceAll)
def WordTemplate(TmplateFileName,OutFileName,Data):
    Word = getWord()
    if Word==None: return False
    Doc = Word.Documents.Open(os.path.abspath(TmplateFileName))
    #Заметить текст во всём документе
    WordFindReplace(Word.Selection.Find,Data['Fields'])
    #Просмотреть области документа
    for i in range(1,Doc.StoryRanges.Count+1):
        Range  = Doc.StoryRanges.Item(i)
        WordFindReplace(Range.Find,Data['Fields'])
    print('SAVE')
    if 'Save'    in Data and Data['Save']:    Workbooks.SaveAs(os.path.abspath(OutFileName))
    if 'Visible' in Data and Data['Visible']: Word.Visible=True
    if 'Close'   in Data and Data['Close']:   Word.Quit()
    return True*/